package com.wangjiacai.hqlQuery.role.configuration;

import com.wangjiacai.hqlQuery.role.service.TokenUserService;
import com.wangjiacai.hqlQuery.role.service.impl.DefaultTokenUserService;
import com.wangjiacai.utils.web.service.RedisService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;


/*
 * @auther: wangjiacai
 *
 * @create: 2019-01-27 14:47:17
 */
@Configuration
@ComponentScan(basePackages = RoleFunctionConfiguration.basePackage)
@EnableJpaRepositories(basePackages = RoleFunctionConfiguration.basePackage)
@EntityScan(basePackages = RoleFunctionConfiguration.basePackage)
public class RoleFunctionConfiguration {

    public static final String basePackage="com.wangjiacai.hqlQuery.role";

    @Bean
    @ConditionalOnMissingBean(TokenUserService.class)
    @ConditionalOnBean(RedisService.class)
    public TokenUserService tokenUserService(){
        return new DefaultTokenUserService();
    }


}
